package com.xuan.bigdog.lib.chat.enums;

/**
 * 消息发出还是接受
 * 
 * @author xuan
 */
public enum DGMessgeDirection {
	// 1：接受、2：发出
	RECEIVE(1), SEND(2);

	private int value;

	DGMessgeDirection(int value) {
		this.value = value;
	}

	public int getValue() {
		return value;
	}

	public static DGMessgeDirection valueOf(int value) {
		DGMessgeDirection messgeDirection = null;
		switch (value) {
		case 1:
			messgeDirection = RECEIVE;
			break;
		case 2:
			messgeDirection = SEND;
		default:
			messgeDirection = RECEIVE;// 默认就算接受
			break;
		}
		return messgeDirection;
	}

	public String getDescription() {
		String desc = null;
		switch (this) {
		case RECEIVE:
			desc = "接受消息";
			break;
		case SEND:
			desc = "发出消息";
			break;
		default:
			desc = "接受消息";// 默认就算接受
			break;
		}
		return desc;
	}

	@Override
	public String toString() {
		return getDescription();
	}

	public boolean equals(DGMessgeDirection messgeDirection) {
		if (null == messgeDirection) {
			return false;
		}
		return value == messgeDirection.value;
	}

}
